#include <Arduino.h>
#include "./Aliyun_TDDNS_Client.h"
#include "./TDDNS.h"
#include <ESP8266WiFi.h>
WiFiClient wifiClient;
const char *ssid = "";     // Enter your WIFI ssid
const char *password = ""; // Enter your WIFI password
String domain = ""; // Enter your domain example: "light.baidu.com"
String secret_id = "";// Enter your aliyun secretId
String secret_key = "";// Enter your aliyun secretkey
AliyunClient aliClient(secret_id, secret_key, &wifiClient, domain);
TDDNS tDDNS;

void initWifi()
{
    Serial.println();
    Serial.print("Configuring access point...");
    WiFi.begin(ssid, password);
    while (WiFi.status() != WL_CONNECTED)
    {
        delay(500);
        Serial.print(".");
    }
    Serial.println("");
    Serial.println("WiFi connected");
    Serial.println("IP address: ");
    Serial.println(WiFi.localIP());
}

void setup()
{
    pinMode(LED_BUILTIN, OUTPUT);
    Serial.begin(115200);
    initWifi();
    delay(1000);
    tDDNS.client(&aliClient);
}
void loop()
{
    tDDNS.update();
    delay(60 * 1000);
}